﻿using System.Messaging;

namespace Patriq.Msmq.Router.Core
{
    public interface IQueueWriter
    {
        void WriteMessage(string queueWritePath, MessageQueueTransaction trans, Message message);
    }

    public class QueueWriter : IQueueWriter
    {
        public void WriteMessage(string queueWritePath, MessageQueueTransaction trans, Message message)
        {
            using (MessageQueue queue = new MessageQueue(queueWritePath))
            {
                queue.Send(message, trans);
            }
        }
    }
}